package com.chainyoung.component_tmperson.ui.mvp.presenter;

import com.chainyoung.common.base.CommonSubscriber;
import com.chainyoung.common.mvp.BasePresenter;
import com.chainyoung.common.utils.RxUtils;
import com.chainyoung.component_tmperson.entity.WalletDebit;
import com.chainyoung.component_tmperson.entity.WalletRepayment;
import com.chainyoung.component_tmperson.ui.mvp.contract.WalletApplyDebitContract;
import com.chainyoung.component_tmperson.ui.mvp.contract.WalletRepaymentScheduleContract;

import java.util.List;
import java.util.TreeMap;

import javax.inject.Inject;

public class WalletRepaymentSchedulePresenter extends BasePresenter<WalletRepaymentScheduleContract.Model, WalletRepaymentScheduleContract.View> {

    @Inject
    public WalletRepaymentSchedulePresenter(WalletRepaymentScheduleContract.Model model, WalletRepaymentScheduleContract.View rootView) {
        super(model, rootView);
    }


    public void getRepaymentScheduleList(TreeMap<String, Object> map) {

        addSubscribe(mModel.getRepaymentScheduleList(map)
                .compose(RxUtils.<List<WalletRepayment>>rxSchedulerHelper())
                .subscribeWith(new CommonSubscriber<List<WalletRepayment>>(mView, true) {
                    @Override
                    public void onNext(List<WalletRepayment> data) {
                        mView.onGetRepaymentScheduleListSuccess(data);
                    }

                    @Override
                    public void onError(Throwable e) {
                        mView.onGetRepaymentScheduleListFailed();
                        super.onError(e);
                    }
                }));
    }



}





